#include<iostream>
using namespace std;

int main(){
	freopen("input.txt","r",stdin);
	int G1,S1,K1,G2,S2,K2;
	scanf("%d.%d.%d %d.%d.%d",&G1,&S1,&K1,&G2,&S2,&K2);
	int r=K2-K1+29*(S2-S1)+29*17*(G2-G1);
	if(r<0){cout<<"-";r=-r;};
	cout<<r/29/17<<".";
	r-=r/29/17*29*17;
	cout<<r/29<<".";
	r-=r/29*29;
	cout<<r<<endl;

}